<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let newsData = [
        { id: 10001, title: "新闻一", isHot: true, content: "内容一积极响应" },
        { id: 10002, title: "新闻二", isHot: false, content: "内容二" },
        { id: 10003, title: "新闻三", isHot: true, content: "内容三" },
        { id: 10004, title: "新闻四", isHot: false, content: "内容四" },
        { id: 10005, title: "新闻五", isHot: true, content: "内容五" },
      ]
      let sign = 0
      for (let i = 0; i < newsData.length; i++) {
        if (newsData[i].id === 10004) {
          sign = i
          document.write(
            `id为10004的新闻是：${newsData[i].title},下标为${sign}`
          )
        }
      }
    </script>
  </body>
</html>
